import json

from Testtongzhi.venv import config


def conver_dict_list_to_tuple_list1(file,keys_to_convert):

    with open('D:\\PycharmProjects\\pythonProject\\Testtongzhi\\data\\login_list.json','r',encoding='utf8') as f:
        data=json.load(f)
    #   使用列表推导式来遍历字典列表，并为每个字典创建一个元组，其中包含根据键列表提取的值
    return [tuple(item[key] for key in keys_to_convert) for item in data]
# print(conver_dict_list_to_tuple_list1(config.BASE_PATH + "D:\PycharmProjects\pythonProject\Testtongzhi\data\login_list.json",
#                                                            ["username","password","rememberMe","code"]))


def conver_dict_list_to_tuple_list2(file,keys_to_convert):

    with open('D:\\PycharmProjects\\pythonProject\\Testtongzhi\\data\\add_list.json','r',encoding='utf8') as f:
        data=json.load(f)
    #   使用列表推导式来遍历字典列表，并为每个字典创建一个元组，其中包含根据键列表提取的值
    return [tuple(item[key] for key in keys_to_convert) for item in data]

def conver_dict_list_to_tuple_list3(file,keys_to_convert):

    with open('D:\\PycharmProjects\\pythonProject\\Testtongzhi\\data\\check_list.json','r',encoding='utf8') as f:
        data=json.load(f)
    #   使用列表推导式来遍历字典列表，并为每个字典创建一个元组，其中包含根据键列表提取的值
    return [tuple(item[key] for key in keys_to_convert) for item in data]


















